/**
 * 
 */
package com.jushu.storbox.database;

import java.util.List;

import com.jushu.storbox.entities.AlbumFileInfo;

/**
 *  Local Album Sync Data
 */
public interface IAlbumDao  extends IBaseDao {
	
	public final static String TABLE_NAME_ALBUM_SYNC_LIST = "tb_album_sync_list";
	
	public final static String TABLE_COMMAND = "Create table " + TABLE_NAME_ALBUM_SYNC_LIST + "("
			+ owner_by + " text," 
			+ file_name + " text," 
			+ parent_folder_id + " text," 
			+ local_path+ " text,"
			+ file_md5 + " text," 
			+ file_size + " integer," 
			+ status + " integer," 
			+ client_ctime + " integer," 
			+ client_mtime + " integer," 
			+ "CONSTRAINT pk_tb_album_sync PRIMARY KEY ("+local_path+","+owner_by +")" 
			+")";
	
	public final static String UPDATE_COMMAND = "Create table " + TABLE_NAME_ALBUM_SYNC_LIST + "("
			+ owner_by + " text," 
			+ file_name + " text," 
			+ parent_folder_id + " text," 
			+ local_path+ " text,"
			+ file_md5 + " text," 
			+ file_size + " integer," 
			+ status + " integer,"
			+ client_ctime + " integer," 
			+ client_mtime + " integer," 
			+ "CONSTRAINT pk_tb_album_sync PRIMARY KEY ("+local_path+","+owner_by +")" 
			+")";
	
	//constant
	public final static int ALBUM_STATUS_NEWFILE = 0;
	public final static int ALBUM_STATUS_BACKING = 1;
	public final static int ALBUM_STATUS_SUCCESS = 2;
	public final static int ALBUM_STATUS_FAILURE = 3;
	
	public void insertFile(AlbumFileInfo albumFileInfo);
	public AlbumFileInfo getFile(String fileName);
	public AlbumFileInfo getFileByPath(String fileName);
	public List<AlbumFileInfo> getNotBackedFileList();
	public int updateAlbumState(AlbumFileInfo albumFileInfo);
	public int updateAlbumStateToNew();
	public void deleteFile(String fileName);
	public void deleteAlbumByPath(String filePath);
	public void deleteAllAlbumFiles();
	public void deleteAlbumFile(AlbumFileInfo info);
	public void deleteAllAlbumFilesByFolder(String parentPath);
	

	public long getTotalAlbumSize();
	public long getUnBackupedSize();
	public int getRemainCount();
	public List<AlbumFileInfo> getFailedAlbumInfoList();
}
